usbcpower2 2.2.0
Loading...
Searching...
No Matches
usbcpower2.h File Reference

This file contains API for USB-C Power 2 Click Driver. More...

#include "drv_digital_out.h"
#include "drv_digital_in.h"
#include "drv_i2c_master.h"

Go to the source code of this file.

Data Structures

struct  usbcpower2_t
 USB-C Power 2 Click context object. More...
struct  usbcpower2_cfg_t
 USB-C Power 2 Click configuration object. More...

Macros

#define USBCPOWER2_REG_VENDOR_ID   0x01
 USB-C Power 2 register list.
#define USBCPOWER2_REG_CONTROL   0x02
#define USBCPOWER2_REG_INTERRUPT_STATUS   0x03
#define USBCPOWER2_REG_CC_STATUS   0x04
#define USBCPOWER2_REG_CON_DET_CONFIG   0x09
#define USBCPOWER2_REG_VCONN_STATUS   0x0A
#define USBCPOWER2_REG_RESET   0x10
#define USBCPOWER2_REG_INTERRUPT_MASK   0x18
#define USBCPOWER2_REG_INTERRUPT_REG_STATUS   0x19
#define USBCPOWER2_VENDOR_ID_DEVICE_VERSION   0x08
 USB-C Power 2 VENDOR_ID register setting.
#define USBCPOWER2_VENDOR_ID_DEVICE_VERSION_MASK   0xF8
#define USBCPOWER2_VENDOR_ID_VENDOR_ID   0x03
#define USBCPOWER2_VENDOR_ID_VENDOR_ID_MASK   0x07
#define USBCPOWER2_CONTROL_RP_SEL_80UA   0x00
 USB-C Power 2 CONTROL register setting.
#define USBCPOWER2_CONTROL_RP_SEL_180UA   0x08
#define USBCPOWER2_CONTROL_RP_SEL_330UA   0x10
#define USBCPOWER2_CONTROL_RP_SEL_MASK   0x18
#define USBCPOWER2_CONTROL_MODE_SEL_DEVICE_UFP   0x00
#define USBCPOWER2_CONTROL_MODE_SEL_HOST_DFP   0x02
#define USBCPOWER2_CONTROL_MODE_SEL_DUAL_ROLE_DRP   0x04
#define USBCPOWER2_CONTROL_MODE_SEL_MASK   0x06
#define USBCPOWER2_CONTROL_INT_MASK_DIS   0x00
#define USBCPOWER2_CONTROL_INT_MASK_EN   0x01
#define USBCPOWER2_CONTROL_INT_MASK_MASK   0x01
#define USBCPOWER2_INTERRUPT_STATUS_CABLE_DETACHED   0x02
 USB-C Power 2 INTERRUPT_STATUS register setting.
#define USBCPOWER2_INTERRUPT_STATUS_CABLE_ATTACHED   0x01
#define USBCPOWER2_CC_STATUS_VBUS_DETECTED   0x80
 USB-C Power 2 CC_STATUS register setting.
#define USBCPOWER2_CC_STATUS_RP_DET_STANDBY   0x00
#define USBCPOWER2_CC_STATUS_RP_DET_STD_USB   0x20
#define USBCPOWER2_CC_STATUS_RP_DET_1_5_A   0x40
#define USBCPOWER2_CC_STATUS_RP_DET_3_0_A   0x60
#define USBCPOWER2_CC_STATUS_RP_DET_MASK   0x60
#define USBCPOWER2_CC_STATUS_PORT_STATUS_NOT_CONNECTED   0x00
#define USBCPOWER2_CC_STATUS_PORT_STATUS_DFP_ATTACHED   0x04
#define USBCPOWER2_CC_STATUS_PORT_STATUS_UFP_ATTACHED   0x08
#define USBCPOWER2_CC_STATUS_PORT_STATUS_ANALOG_AUDIO   0x0C
#define USBCPOWER2_CC_STATUS_PORT_STATUS_DEBUG   0x10
#define USBCPOWER2_CC_STATUS_PORT_STATUS_MASK   0x1C
#define USBCPOWER2_CC_STATUS_CC_POLARITY_CABLE_NOT_ATTACHED   0x00
#define USBCPOWER2_CC_STATUS_CC_POLARITY_CC1_NORMAL   0x01
#define USBCPOWER2_CC_STATUS_CC_POLARITY_CC2_REVERSED   0x02
#define USBCPOWER2_CC_STATUS_CC_POLARITY_MASK   0x03
#define USBCPOWER2_CON_DET_CONFIG_EN   0x00
 USB-C Power 2 CON_DET_CONFIG register setting.
#define USBCPOWER2_CON_DET_CONFIG_DIS   0x01
#define USBCPOWER2_CON_DET_CONFIG_MASK   0x01
#define USBCPOWER2_VCONN_STATUS_STANDBY   0x00
 USB-C Power 2 VCONN_STATUS register setting.
#define USBCPOWER2_VCONN_STATUS_CC1   0x01
#define USBCPOWER2_VCONN_STATUS_CC2   0x02
#define USBCPOWER2_VCONN_STATUS_MASK   0x03
#define USBCPOWER2_RESET_SYSTEM   0x01
 USB-C Power 2 RESET register setting.
#define USBCPOWER2_INTERRUPT_MASK_CC1_CC2_CHANGE_DIS   0x00
 USB-C Power 2 INTERRUPT_MASK register setting.
#define USBCPOWER2_INTERRUPT_MASK_CC1_CC2_CHANGE_EN   0x10
#define USBCPOWER2_INTERRUPT_MASK_CC1_CC2_CHANGE_MASK   0x10
#define USBCPOWER2_INTERRUPT_MASK_ROLE_CHANGE_DIS   0x00
#define USBCPOWER2_INTERRUPT_MASK_ROLE_CHANGE_EN   0x08
#define USBCPOWER2_INTERRUPT_MASK_ROLE_CHANGE_MASK   0x08
#define USBCPOWER2_INTERRUPT_MASK_ORIENTATION_DIS   0x00
#define USBCPOWER2_INTERRUPT_MASK_ORIENTATION_EN   0x04
#define USBCPOWER2_INTERRUPT_MASK_ORIENTATION_MASK   0x04
#define USBCPOWER2_INTERRUPT_MASK_DEBUG_DIS   0x00
#define USBCPOWER2_INTERRUPT_MASK_DEBUG_EN   0x02
#define USBCPOWER2_INTERRUPT_MASK_DEBUG_MASK   0x02
#define USBCPOWER2_INTERRUPT_MASK_AUDIO_DIS   0x00
#define USBCPOWER2_INTERRUPT_MASK_AUDIO_EN   0x01
#define USBCPOWER2_INTERRUPT_MASK_AUDIO_MASK   0x01
#define USBCPOWER2_INTERRUPT_REG_STATUS_CC1_CC2_CHANGE   0x10
 USB-C Power 2 INTERRUPT_REG_STATUS register setting.
#define USBCPOWER2_INTERRUPT_REG_STATUS_ROLE_CHANGE   0x08
#define USBCPOWER2_INTERRUPT_REG_STATUS_ORIENTATION   0x04
#define USBCPOWER2_INTERRUPT_REG_STATUS_DEBUG   0x02
#define USBCPOWER2_INTERRUPT_REG_STATUS_AUDIO   0x01
#define USBCPOWER2_DEVICE_ADDRESS   0x1D
 USB-C Power 2 device address setting.
#define USBCPOWER2_MAP_MIKROBUS(cfg, mikrobus)
 MikroBUS pin mapping.

Enumerations

enum  usbcpower2_return_value_t { USBCPOWER2_OK = 0 , USBCPOWER2_ERROR = -1 }
 USB-C Power 2 Click return value data. More...

Functions

void usbcpower2_cfg_setup (usbcpower2_cfg_t *cfg)
 USB-C Power 2 configuration object setup function.
err_t usbcpower2_init (usbcpower2_t *ctx, usbcpower2_cfg_t *cfg)
 USB-C Power 2 initialization function.
err_t usbcpower2_default_cfg (usbcpower2_t *ctx)
 USB-C Power 2 default configuration function.
err_t usbcpower2_write_reg (usbcpower2_t *ctx, uint8_t reg, uint8_t data_in)
 USB-C Power 2 write register function.
err_t usbcpower2_read_reg (usbcpower2_t *ctx, uint8_t reg, uint8_t *data_out)
 USB-C Power 2 read register function.
uint8_t usbcpower2_get_id_pin (usbcpower2_t *ctx)
 USB-C Power 2 get ID pin function.
uint8_t usbcpower2_get_int_pin (usbcpower2_t *ctx)
 USB-C Power 2 get INT pin function.
err_t usbcpower2_check_com (usbcpower2_t *ctx)
 USB-C Power 2 communication check function.

Detailed Description

This file contains API for USB-C Power 2 Click Driver.

Enumeration Type Documentation

◆ usbcpower2_return_value_t

USB-C Power 2 Click return value data.

Predefined enum values for driver return values.

Enumerator
USBCPOWER2_OK 
USBCPOWER2_ERROR